Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests(smokehouse): fail on finalUrl/errorCode mismatches #7227

Merged
merged 6 commits into from
Feb 14, 2019

Conversation

connorjclark
Copy link
Collaborator

Fixes #7225.


let correctCount = 0;
let failedCount = 0;
results.audits.forEach(auditAssertion => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
results.audits.forEach(auditAssertion => {
[results.finalUrl, results.errorCode, ...results.audits].forEach(auditAssertion => {

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could do this instead and drop the two reportAssertions above.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice

do we want to continue showing green ticks for passing? this is what it looks like with those changes + moving reportAssertion out of the if statement:

image

Keeping reportAssertion where it is-

image

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i like this best

image

@brendankenny brendankenny changed the title smokehouse: count failedUrl/errorCode mismatches tests(smokehouse): fail on failedUrl/errorCode mismatches Feb 12, 2019
Copy link
Member

@brendankenny brendankenny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I personally prefer the shorter version

It's more compact, which is nice when looking at CI logs (we have 17 sets of expectations now), you get the failed assertion and diff if there was a failure, and you can always look in the individual expectations files if you need to see what all the passing tests were (we can make a --verbose flag to print all of them, but I doubt anyone will ever use it).

@brendankenny brendankenny changed the title tests(smokehouse): fail on failedUrl/errorCode mismatches tests(smokehouse): fail on finalUrl/errorCode mismatches Feb 12, 2019
@patrickhulce
Copy link
Collaborator

I kinda like the verbose version. My most common use case when actually running smoketests is picking a particular smoke test and running it frequently so I kinda like the ability to see what's passing. I have no strong feelings on the length of passing CI logs since those are collapsed for me anyhow :)

@connorjclark
Copy link
Collaborator Author

--verbose it is!

@connorjclark
Copy link
Collaborator Author

Went with an env flag since wiring an option would be more work (see how run-smokehouse parses argv).

Copy link
Collaborator

@patrickhulce patrickhulce left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM % nits

@@ -35,6 +35,7 @@ const PAGE_HUNG_EXIT_CODE = 68;
const INSECURE_DOCUMENT_REQUEST_EXIT_CODE = 69;
const RETRIES = 3;
const NUMERICAL_EXPECTATION_REGEXP = /^(<=?|>=?)((\d|\.)+)$/;
const VERBOSE = process.env.LH_SMOKE_VERBOSE === '1';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WDYT about just Boolean(process.env.LH_SMOKE_VERBOSE)?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

later down we use a env var SMOKEHOUSE_DEBUG maybe we should unify these two 🤔

maybe we rename that one to LH_SMOKE_DEBUG?

@@ -276,8 +277,12 @@ function reportAssertion(assertion) {
RegExp.prototype.toJSON = RegExp.prototype.toString;

if (assertion.equal) {
console.log(` ${log.greenify(log.tick)} ${assertion.category}: ` +
log.greenify(assertion.actual));
if (assertion.actual !== null && typeof assertion.actual === 'object') {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

super nit but mind flipping the order of these to is an object && is not null? took me a bit to realize this was just an object check

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we just use a helper method like so?

const isPlainObject = function (obj) {
	return Object.prototype.toString.call(obj) === '[object Object]';
};

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Object.prototype.toString.call(obj) === '[object Object]';

what year is it?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:P

Copy link
Member

@brendankenny brendankenny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

lighthouse-cli/test/smokehouse/smokehouse.js Outdated Show resolved Hide resolved
@@ -62,7 +63,7 @@ function resolveLocalOrCwd(payloadPath) {
* @return {ExpectedLHR}
*/
function runLighthouse(url, configPath, isDebug) {
isDebug = isDebug || Boolean(process.env.SMOKEHOUSE_DEBUG);
isDebug = isDebug || Boolean(process.env.LH_SMOKE_DEBUG);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doesn't debug also save the LHR? Up to y'all if you want that :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nah. just writing to disk is good enough for me. verbose shouldn't be too verbose

Co-Authored-By: Hoten <cjamcl@gmail.com>
@googlebot
Copy link

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and have the pull request author add another comment and the bot will run again. If the bot doesn't comment, it means it doesn't think anything has changed.

@paulirish paulirish merged commit 197f55f into master Feb 14, 2019
@paulirish paulirish deleted the issue-7225-smokehouse-count branch February 14, 2019 21:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants